OpenScript is a plugin for every HTTP server compatible with W*API 1.1 (like WebSTAR, Quid Pro Quo, AppleShare IP or WebTen).
It allows you to include AppleScript, MacPerl and Frontier commands in your HTML pages. You can also write nested commands so you can use Frontier commands inside AppleScript scripts, AppleScript commands in Frontier scripts an so on, also mixing MacPerl commands.
Installation
To install OpenScript, follow these steps:
1) Quit WebSTAR.
2) Copy the file "OpenScript" (or OpenScript Demo) into the Plug-Ins folder in the same folder as WebSTAR.
3) Relaunch WebSTAR.
Once OpenScript is installed, all the files with the suffix ".script" are filtered.
How can I use it?
Just write the scripts inside the <Applescript>…</Applescript> or <Usertalk>…</Usertalk> TAGs, OpenScript execute them and place the result in your HTML page.
Example:
<applescript>
set pathToUse to "Macintosh HD:page.html"
set f to open for access file pathToUse
set s to read f for get eof f
close access f
return s
</applescript>
this simple script place the contents of the file"page.html" into the page you are serving.
Try to write nested TAGs in order to use the best commands of both the scripting languages (you have to append a number at the end of the TAG to specify the execution order of the scripts).
after OpenScript has processed this script, it will put the result (51) in your HTML page.
In order to use connection oriented information, you can use the OpenScript internal TAGs as described below.
Example:
<APPLESCRIPT>
if "<OpenScript?ip>" = "195.120.139.130" then
return "Welcome Marco Bambini"
else
return "Welcome <OpenScript?client_domain> from <OpenScript?ip>"
end if
</APPLESCRIPT>
if I'll come to visit this page, I'll receive a Welcome message.
OpenScript internal TAGs:
<OpenScript?path>
Path argument portion of URL
<OpenScript?search>
Search argument portion of URL
<OpenScript?username>
Username for current authentication scheme
<OpenScript?password>
Password for current authentication scheme
<OpenScript?from>
"From" header field
<OpenScript?client_domain>
Domain name of client
<OpenScript?server_domain>
Domain name of server
<OpenScript?port>
Port number server is listening on
<OpenScript?refer>
"Referer" HTTP header field value
<OpenScript?agent>
"User-Agent" HTTP header field value
<OpenScript?ip>
Client's IP address
<OpenScript?http_request>
Entire HTTP request as received from the client
<OpenScript?mime>
MIME type of requested URL as determined by server
<OpenScript?header>
Preconstructed response header field for server name
<OpenScript?server_path>
Local file system path to the server's document tree
<OpenScript?file_path>
Local file system name for the requested file
<OpenScript?mod>
True/false if file has been modified since last client request
<OpenScript?date>
If-modified-since date string from HTTP header field
<OpenScript?security>
Name of security realm (if any) protecting requested file
<OpenScript?connection_id>
Unique ID for this HTTP connection
<OpenScript?execution_id>
Unique ID for this execution of the server
PIXO Support
The PIXO ("Plug-In Cross-Over") API is a 'standardized' way for Web server plug-ins to communicate and cooperate for better performance, advanced integration, and extra Web site coolness.
The server calls each plug-in directly and the plug-in returns the results directly to the server. Since plug-ins are all loaded directly into the server, there has not been any way to combine the features of plug-ins the way CGIs could be combined. Now that there are more plug-ins than ever and they're doing more and more interesting things, it has once again become critical that plug-ins have some way of calling each other.
PIXO ("plug-in cross-over") is an API that allows plug-ins loaded into the same server to call each other just as CGIs could but without the overhead of AppleEvents or TCP/IP. Using PIXO, modern Web server plug-ins can now call upon each other's services directly, using a simple, high-performance API, and can be combined to create extremely powerful Web sites, services, and applications.
OpenScript acts as both a PIXO SOURCE and PROCESSOR, it's action name is OPENSCRIPT_PIXO.
Tips
All the error messages reported by OpenScript are located inside its resource fork in resources of type TEXT, so you can customize them.
Contact information
Marco Bambini
Via Piave n.21
46015 Cicognara (MN)
ITALY
marco.bambini@kagi.com
Connect to http://www.geocities.com/SiliconValley/Network/7185/ (software section) for the latest info.
Copyright
All this material is copyright 1998-99 by Marco Bambini.
OpenScript is released as is without any warranty.
Special thanks to Chuck Shotton, Grant Hulbert, Eric Bickford and ClearWay Technologies.
You can create powerful dynamic pages with AppleScript, MacPerl and Frontier scripts!!